import java.util.*;                
public class Player
{
    private int strength = 100;
    public Map<String, Thing> bag = new HashMap<>();
    
    public void step(){
        this.strength-=10;
        System.out.println("越走越困，你的体力又下降了");
        System.out.println("能量剩余："+ this.strength);
        System.out.println(" ");
        if(this.strength<=0){
            System.out.println("你的能量消耗完了.");
            System.out.println("你没了. ");
            System.out.println("再见.");
            System.exit(1);
        }
        
    }
    
    public void eat (String thingName){                       
        Thing thing = bag.get(thingName);
        if(thing !=null){
            this.strength +=thing.getEnergy();
            if(thing.getEnergy()>0)
                System.out.println("你的能量增加了"+thing.getEnergy()+".");
               else{
               System.out.println("你食用了坏的东西");
               System.out.println("你的能量减少了 "+thing.getEnergy()+".");
            }
            if(this.strength > 100)
                this.strength = 100;
            System.out.println("现在，你的能量为 "+this.strength+".");
        }
        else
            System.out.println("吃什么???");
        bag.remove(thingName);
        if(this.strength<=0){
            System.out.println("你的能量消耗完了.");
            System.out.println("你没了. ");
            System.out.println("再见.");
            System.exit(1);
        }
    }
    
    public void pick(Thing thing){
        if(thing==null)
            System.out.println("没有东西让你捡！！！");
        else{
            bag.put(thing.getName(),thing);
            System.out.println("玩家捡起了 "+thing.getName()+"*1.");
            if(thing.getName().equals("棒球棒"))
            {
                System.out.println("攻击力+100");
            }
            if(thing.getName().equals("道具盔甲"))
            {
                System.out.println("防御力+100");
            }
        }
    }
    
    public void checkss(){
        for(String key : bag.keySet()){
            System.out.println("   "+key);
        }
    }
    
    public int getS(){
        return this.strength;
    }
    
    
}

